home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form frmPrinc
- BorderStyle = 1 'Fixed Single
- Caption = "Archivos INI"
- ClientHeight = 2055
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 5280
- Icon = "frmPrinc.frx":0000
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 2055
- ScaleWidth = 5280
- StartUpPosition = 2 'CenterScreen
- Begin VB.CommandButton cmdSalir
- Caption = "Salir"
- Height = 375
- Left = 4200
- TabIndex = 9
- Top = 1440
- Width = 855
- End
- Begin VB.Frame Frame1
- Caption = " Valor a escribir "
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 1575
- Left = 240
- TabIndex = 2
- Top = 120
- Width = 3135
- Begin VB.TextBox txtValor
- Height = 285
- Left = 840
- TabIndex = 8
- Top = 1080
- Width = 2055
- End
- Begin VB.TextBox txtClave
- Height = 285
- Left = 840
- TabIndex = 7
- Top = 720
- Width = 2055
- End
- Begin VB.TextBox txtSeccion
- Height = 285
- Left = 840
- TabIndex = 6
- Top = 360
- Width = 2055
- End
- Begin VB.Label Label3
- AutoSize = -1 'True
- Caption = "Valor:"
- Height = 195
- Left = 120
- TabIndex = 5
- Top = 1080
- Width = 405
- End
- Begin VB.Label Label2
- AutoSize = -1 'True
- Caption = "Clave:"
- Height = 195
- Left = 120
- TabIndex = 4
- Top = 720
- Width = 450
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- Caption = "Secci
- Height = 195
- Left = 120
- TabIndex = 3
- Top = 360
- Width = 630
- End
- End
- Begin VB.CommandButton cmdLeer
- Caption = "Leer ARCH.INI"
- Height = 495
- Left = 3480
- TabIndex = 1
- Top = 840
- Width = 1575
- End
- Begin VB.CommandButton cmdEscribir
- Caption = "Escribir ARCH.INI"
- Height = 495
- Left = 3480
- TabIndex = 0
- Top = 240
- Width = 1575
- End
- Attribute VB_Name = "frmPrinc"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub cmdEscribir_Click()
- Dim S As String 'Seccion a escribir
- Dim C As String 'Clave a escribir
- Dim V As String 'Valor a escribir
- S = txtSeccion 'Cargo el contenido de
- C = txtClave 'las cajas de texto en variables que
- V = txtValor 'puedan ser pasadas a la funci
- 'Escribo finalmente en el archivo INI
- Call WritePrivateProfileString(S, C, V, "ARCH.INI")
- End Sub
- Private Sub cmdLeer_Click()
- Dim S As String 'Seccion de la cual leer
- Dim C As String 'Clave a leer
- Dim V As String * 128 'Variable donde situar el valor leido
- Dim CarsLeidos As Long 'Caracteres leidos
- S = txtSeccion + Chr(0) 'Los parametros que se pasan a la
- C = txtClave + Chr(0) 'funcion son Strings
- V = Space(128) 'Lleno la cadena de espacios
- CarsLeidos = GetPrivateProfileString(S, C, "ERROR", V, 128, "ARCH.INI")
- 'Tomo la parte importante de la cadena devuelta por la funci
- 'y la pongo en la caja de texto "Valor"
- txtValor = Left(V, CarsLeidos)
- End Sub
- Private Sub cmdSalir_Click()
- End
- End Sub
-